package com.java.multipledatasource.thread;

/**
 * @author hu
 * @version 1.0
 * @date 2021/1/15 0015 下午 8:58
 * @description
 */
public class Thread01 {
    static class MyThread extends Thread{
        @Override
        public void run() {
            System.out.println("extends");
        }
    }

    static class MyThreadImpl implements Runnable {

        @Override
        public void run() {
            System.out.println("implements");
        }
    }

    static class ThreadJoin extends Thread{

        private Integer num;

        public Integer getNum() {
            return num;
        }

        public void setNum(Integer num) {
            this.num = num;
        }

        public ThreadJoin(Integer num) {
            this.num = num;
        }

        @Override
        public void run() {
            System.out.println("num: " + num);
        }
    }

    public static void main(String[] args) throws InterruptedException {

        // 2 -> 1 -> 3



        Thread t2 = new Thread(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t2");
        });

        Thread t1 = new Thread(() -> {
//            try {
//                t2.join();
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
            System.out.println("t1");
        });

        Thread t3 = new Thread(() -> {
//            try {
//                t1.join();
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
            System.out.println("t3");
        });


        t1.start();
        t2.start();
        t3.start();
    }
}
